Contents | Index | < Browse | Browse >
LETTERreallocULETTER
Changes an object's memory size.
Overview
#include <stdlib.h>
newmem = realloc(oldmem,newsize);
void *newmem;
void *oldmem;
size_t newsize;
Portability
ANSI
Description
This function allocates a new memory block with a size of "newsize" bytes.
The object pointed to by "oldmem" will be entirely copied (or as much as
possible, if the new memory block is smaller than the old one) and the old
memory will be freed.
If realloc could not allocate the new memory block the old object will not
be freed.
Due to AmigaOS's memory management StormC always needs to allocate new
memory, a partial extending or shortening of an existing memory block is not
possible.
Returns
A pointer to the new memory block or NULL if an error occured.
See also
malloc , calloc , free